﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using Moq;
using MoqContrib.AutoMock.Tests.AutoMockingContainers;

namespace MoqContrib.AutoMock.Tests.MockingUtilitiesTests
{
    [TestFixture]
    class WhenGettingAMockForAnObject
    {
        [Test]
        public void I_will_find_the_mock_for_a_real_mocked_object()
        {
            var mock = new Mock<IService>();
            var result = MockingUtilities.GetMockFor(mock.Object);
            Assert.That(result, Is.SameAs(mock));
        }

        [Test]
        public void I_will_return_null_if_its_not_a_real_mocked_object()
        {
            var obj = new MoqContrib.AutoMock.Tests.TheMockHeap.WhenUsingAKey.Service();
            var result = MockingUtilities.GetMockFor(obj);
            Assert.That(result, Is.Null);
        }
    }
}
